package day05.ZuoyeDemo;
//   1、Addition随机加法运算器
//   要求：由系统随机出10道加法题，而后由用户来答题，答题后输出"答对了"或"答错了"，答对1题得10分，答错1题不扣分，最后输出总分数。
import java.util.Scanner;
public class AdditionDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("欢迎使用大铁棍随机加法运算器");
        int ChengJi = 0;
        for (int a=1;a>=1 && a<=10;a++){
            int a1 = (int) (Math.random()*100);
            int a2 = (int) (Math.random()*100);
            int b = a1+a2;
            System.out.println("("+a+")"+a1+"+"+a2+"="+"？");
            System.out.println("请作答：");
            int c = scan.nextInt();
            if (b==c){
                System.out.println("恭喜你 答对啦！");
                ChengJi += 10;
            }else {
                System.out.println("实在抱歉 答错了！");
            }
        }
        System.out.println("总成绩为："+ChengJi+"分");

        //   2.MultiTable九九乘法表
        //   要求：输出九九乘法表
        for (int a=1;a<=9;a++){
            for (int b=1;b<=a;b++){
                System.out.print(b+"*"+a+"="+a*b);
            }
            System.out.println();
        }

        //3. 数组小代码练习：声明、初始化、访问、遍历
        int [] a1 = new int[10];
        for (int a2=0;a2<a1.length;a2++){
            a1[a2] = (int) (Math.random()*100);
            System.out.println(a1[a2]);
        }
    }
}
